import fetch from '@/axios'

/**
 * 用户登录接口，auth2的token模拟
 * @param {*} data 
 */
export const login = (data) => {
    return fetch({
        url: '/auth/oauth/token',
        data,
        method: 'post',
        headers: {
          Authorization: 'Basic bXBtczptcG1z'
        }
    })
}

/**
 * 获得用户信息
 */
export const getUserInfo = () => {
    return fetch({
        url: 'admin/user/findUser',
        method: 'get'
    })
}

/**
 * 根据当前登录用户获得菜单信息
 */
export const getMenus = () => {
    return fetch({
        url: 'admin/menu/list',
        method: 'get'
    })
}

/**
 * 退出登录
 */
export const signOut = () => {
    return fetch({
        url: 'admin/signOut',
        method: 'get'
    })
}

/**
 * 用户列表
 */
export const userList = (obj) => {
    return fetch({
        url: 'admin/user/userList',
        method: 'get',
        params: obj
    })
}